package  
{
	import flash.text.*;
	import flash.display.*;
	import flash.events.*;
	/**
	 * ...
	 * @author Daria Savkova
	 */
	public class Medikit extends MovingCircle
	{
		private const hp:int=200;
		public function Medikit(stage: Stage, t: Player) 
		{
			super(10, 0.0);	
			MaskInteract = GroupPlayer | GroupEnemy;
			MaskCollide = 0;
			MaskPublic = 0;
			Draw();
		}
		
		override public function Interact(o:MovingCircle):Boolean
		{
			if (super.Interact(o))
			{
				var pl:Player = o as Player;
				if (pl && !pl.posesses)
				{
					this.Damage(0xf1c1);
					pl.hitpoints += hp;
					if (pl.hitpoints > pl.MAXHP)
						pl.hitpoints = pl.MAXHP;
					trace(pl.hitpoints);
					removeMe = true;
					Main.Instance().updateHpBar();
					return true;
				}
			}
			return false;
		}
		
		override protected function Draw():void
		{
			graphics.clear();
				graphics.beginFill(0xDDDDDD);
			graphics.drawCircle(0, 0, r);
			graphics.endFill();
			var field:TextField = new TextField();
			field.text = "♥";
			field.x = x-50;
			field.y = y-15;
			field.autoSize = TextFieldAutoSize.CENTER;
			field.background = false;
			field.border = false;
			field.textColor = 0xFF1111;
			var formatter:TextFormat = new TextFormat();
			formatter.bold = true;
			formatter.size = 20;
			formatter.align = "center";
			field.setTextFormat(formatter);
			addChild(field);
		}
		
		override public function movePlayer(event:Event):void
		{}
		
		override public function moveForward():void
		{}

		
	}

}